﻿using System.Collections.Generic;
using System.Web.Mvc;
using Dinner.Models.Validation;

namespace Dinner.Controllers
{
	public static class ControllerHelpers
	{
		public static void AddRuleViolations(this ModelStateDictionary modelState, IEnumerable<RuleViolation> errors)
		{
			foreach (RuleViolation issue in errors)
			{
				modelState.AddModelError(issue.PropertyName, issue.ErrorMessage);
			}
		}
	}
}
